using Crocodile.AbstractLanguage;
using Crocodile.AbstractLanguage.Tree;
using JetBrains.Annotations;



namespace Crocodile.CsharpLanguage.Tree
{
    public abstract class CsRoutine : CsDeclaration
    {
        /// <summary>
        /// Parameters (without result).
        /// </summary>
        [NotNull]
        public readonly Nest<CsRoutine,CsParameter> Parameters;
            

        /// <summary>
        /// Method body - statements.
        /// </summary>
        [NotNull]
        public readonly Nest<CsRoutine,CsStatement> Content;


        /// <summary>
        /// Result type. Null means 'void'.
        /// </summary>
        [CanBeNull]
        public string TypeDef;


        /// <summary>
        /// Method is partial.
        /// </summary>
        public bool Partial;


        protected CsRoutine()
        {
            Parameters = new Nest<CsRoutine, CsParameter>(this);
            Content = new Nest<CsRoutine,CsStatement>(this);
        }


        public CsClass Class { get { return Parent as CsClass; } }

    }
}